{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from GAD import *\n",
    "import torch\n",
    "import skimage.io as io\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def to_torch(I):\n",
    "    return torch.from_numpy(I.transpose((2,0,1))[np.newaxis,:,:,:])\n",
    "\n",
    "def to_numpy(I):\n",
    "    return np.squeeze(I.numpy(),0).transpose((1,2,0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASEAAAEYCAYAAAATaEB+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAEItJREFUeJzt3FusXFd9x/Hvr3EutFBMAokiO22C8AM8tCG1IAhU0QBVSBHJQ5CCkLBQJEu9SCAq0aSVWiH1ofSBINQKajWopuKSlItiRbQ0SoLaF0JsciHBDTEVJZYjLJQLRUhtA/8+zDrJiX3sMz5n5qzZe74f6Wj2XrOOz3/PXvNba8+MJ1WFJPXyS70LkLTcDCFJXRlCkroyhCR1ZQhJ6soQktTVXEIoydVJHktyJMlN8/gbksYhs/6cUJKzgO8B7wCOAvcD762q7870D0kahXmshN4AHKmq/6yq/wW+CFw7h78jaQS2zeHf3AE8sWr/KPDGEzsl2Qvsbbu/NYc6JPX146p61Xqd5hFCWaPtpGu+qtoH7ANI4v8dkcbnv6bpNI/LsaPAJav2dwLH5vB3JI3APELofmBXksuSnAPcAByYw9+RNAIzvxyrqueS/BHwdeAs4DNV9eis/46kcZj5W/QbKsLXhKQxOlRVu9fr5CemJXVlCEnqyhCS1JUhJKkrQ0hSV4aQpK4MIUldGUKSujKEJHVl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ZcB3wNeN5RjaHW8tG2fDdzX6roduKG1fxr4/bb9B8Cn2/YNwG0LcA4+DHweuLPtD6b2VssPgFee0DaT8dP7wN4EfH3V/s3Azb0f8FPUeukJIfQYcHHbvpjJBy4B/g5471r9FuWHyX82fscQjwH4ZeDbwBuZfEp324ljCfg68Ka2va31S8eadzL59tGrgDvbk3MQta86hrVCaCbjp/fl2FRfgLagNvWlbr205f3rmawmBnMM7XLmQSZfGXMXkxX0M1X1XOuyusbn62/3PwtcsLUVv8gngI8Av2j7FzCc2lfM/IsNV/T+bxtTfQHawCzsMSV5KfBl4ENV9ZP2zQhrdl2jresxVNXPgcuTbGfynVavXatbu12Y+pO8CzheVYeSvHWleY2uC1f7CWb+xYYreq+EhvwFaIP6UrckZzMJoM9V1Vda86COAaCqngG+weS1hu1JVibS1TU+X3+7/+XAU1tb6fPeDLw7yQ+ALzK5JPsEw6j9eTXHLzbsHUL3A7vaOwXnMHkh7kDnmqY1mC91y2TJcytwuKo+vuquQRxDkle1FRBJXgK8HTgM3Atc37qdWP/KcV0P3FPtxYmtVlU3V9XOqrqUyfi+p6rexwBqX5F5f7HhArzgdQ2Td2u+D/xZ73pOUeMXgCeB/2OS8jcyuU6/G3i83Z7f+gb423Y83wF2L0D9b2GyHH4YeLD9XDOUYwB+A3ig1f8I8Oet/dXAt5h8gd4/Aee29vPa/pF2/6t7n4NW11t54d2xwdTean2o/Ty68jyd1fjxv21I6qr35ZikJWcISerKEJLUlSEkqStDSFJXhpCkrgwhSV39P9NxqhghUdnGAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "input_image = 1.0 * io.imread('tri-2.png')\n",
    "io.imshow(input_image / 255)\n",
    "input_image_torch = to_torch(input_image)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw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n9LdeOLfEvB14G2jvXGMS2PNW5k8ffQq4K7xj3Nd1L7oGJYKoRX5++k+HZvqAWhr1Gk91K3LmN6/mclsYt0cwzideZDJI2PuZjKDfqaqnhtDFtf4Qv1j/7PAha9sxb/kRuATwPNj+0LWT+0LVvzBhgu6v7Yx1QPQ1pk1e0xJzgO+DHysqn4ynoyw5NAl+lqPoap+DlyWZBOTZ1q9calhY71m6k/yHuB4VR1JcuVC9xJD11ztJ1jxBxsu6J4JrecHoK2rh7olOYtJAH22qr4yutfVMQBU1TPAN5hca9iUZOF/pItrfKH+sf984KlXttIXXAG8N8kPgC8wOSW7kfVR+wtqFR9s2B1C9wPbx52Cs5lciDvYXNO01s1D3TKZ8twKHK2qTy/atS6OIcnrxgyIJK8C3gkcBe4F3jeGnVj/wnG9D7inxsWJV1pVfbKqtlbVJUz+vu+pqj9kHdS+IKv9YMM1cMHrGiZ3a74P/Hl3PS9S4+eBJ4H/Y5Lye5icpx8CHh/rC8bYAH83juc7wI41UP/bmUyHHwYeHMs16+UYgN8CHhj1PwL8xeh/PfAtJg/Q+yJwzug/d2zPjf2v7/4djLqu5Bd3x9ZN7aPWh8by6MK/05X6+/FrG5JadZ+OSTrDGUKSWhlCkloZQpJaGUKSWhlCkloZQpJa/T9vpsxxmkeX6QAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "guide_image = 1.0 * io.imread('rect.png')\n",
    "io.imshow(guide_image / 255)\n",
    "guide_image_torch = to_torch(guide_image)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7fd5f1be9550>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASEAAAEYCAY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vm07gcb9iDhdQumtTXfAfDvuy6PU8Y/AvA4gENMKX8HpnH6AwC+3YyvbtYlAL/X7M/XAby6B+X/x5ja4a8B+Eoz3DKUfQDwjwB8uSn/NwD8h2b5iwH8FaYP0PtjAAfN8tPN/IXm8xd3fQ6act2MK7Vjgyl7U9avNsM3+T5d1fUT3TZCoVCn6jocC4VCO66AUCgU6lQBoVAo1KkCQqFQqFMFhEKhUKcKCIVCoU4VEAqFQp3q/wPQaPw+h7wvLAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "output_torch = anisotropic_diffusion(guide_image_torch.cuda(), guide_image_torch.cuda(), input_image_torch.cuda(), is_log=False, N=1000)\n",
    "output = to_numpy(output_torch.cpu())\n",
    "io.imshow(output / 255)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
